package com.hunan.yllxy.config;

import io.minio.MinioClient;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: 刘华
 * @Date: 2024/2/27 0027 10:10
 * @Version 1.0
 */
@Configuration
public class MinioConfig {
    @Value("${oss.endpoint}")
    private String url;
    @Value("${oss.access-key}")
    private String accessKey;
    @Value("${oss.secret-key}")
    private String secretKey;

    @Bean
    public MinioClient minioClient() {
        return MinioClient.builder()
                // api地址
                .endpoint(url)
                // 前面设置的账号密码
                .credentials(accessKey, secretKey)
                .build();
    }
}
